
package com.jf.cloud.product.service;

import com.jf.cloud.api.product.dto.SkuStockLockDTO;
import com.jf.cloud.common.database.dto.PageDTO;
import com.jf.cloud.common.database.vo.PageVO;
import com.jf.cloud.common.product.dto.SkuDTO;
import com.jf.cloud.common.product.vo.StockBillLogVO;
import com.jf.cloud.product.bo.mongo.MongoStockBillLogBO;
import com.jf.cloud.product.dto.StockBillLogDTO;
import com.jf.cloud.product.model.StockBillLog;
import com.jf.cloud.product.vo.StockBillLogExcelVO;
import com.jf.cloud.product.vo.mongo.MongoStockBillLogVO;

import java.util.List;

/**
 * 出入库明细
 *
 * @author zz
 * @date 2022-06-22 16:57:26
 */
public interface StockBillLogService {

    /**
     * 分页获取出入库明细列表
     * @param pageDTO 分页参数
     * @param stockBillLogDtO
     * @return 出入库明细列表分页数据
     */
    PageVO<MongoStockBillLogBO> page(PageDTO pageDTO, StockBillLogDTO stockBillLogDtO);

    /**
     * 根据出入库明细id获取出入库明细
     *
     * @param stockBillLogId 出入库明细id
     * @return 出入库明细
     */
    MongoStockBillLogVO getByStockBillLogId(Long stockBillLogId);

    /**
     * 获取导出的出入库明细列表
     * @param stockBillLogDTO
     * @return
     */
    List<StockBillLogExcelVO> exportStockBillLogList(StockBillLogDTO stockBillLogDTO);

    /**
     * 保存出入库明细信息
     * @param stockBillLog
     */
    void saveInfo(StockBillLogVO stockBillLog);


    /**
     * 根据订单生成出入库明细
     * @param orders
     * @param stockBillType
     * @param stockType
     */
    void generateStockLogOfOrderList(List<SkuStockLockDTO> orders, Integer stockBillType, Integer stockType);

    /**
     * 更新出入库明细信息
     * @param stockBillLogDTO
     */
    void updateInfo(StockBillLogDTO stockBillLogDTO);

    /**
     * 获取出入库订单号关联数量
     * @param orderId
     * @param value
     * @return
     */
    long countByOrderId(Long orderId, Integer value);

    /**
     * 作废出入库明细单
     * @param shopId
     * @param stockBillLogId
     */
    void voided(Long shopId, Long stockBillLogId);

    /**
     * 通过实物盘点创建库存变更日志
     * @param stockBillLog
     * @param skuDTOList
     */
    void generateStockLogOfTakeStock(StockBillLog stockBillLog, List<SkuDTO> skuDTOList);
}
